package com.lfy.modules.common.custom.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.io.File;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

@AllArgsConstructor
@Getter
public enum FileShareOutTimeEnum {
    PERMANENT(0, -1L),
    THIRTY_DAYS(1, 30L * 24 * 60 * 60 * 1000),
    ONE_WEEK(2, 7L * 24 * 60 * 60 * 1000),
    ONE_DAY(3, 24L * 60 * 60 * 1000),
;

    final Integer code;
    final Long value;
    static Map<Integer,Long> map;
    static {
        map = Arrays.stream(FileShareOutTimeEnum.values()).collect(Collectors.toMap(FileShareOutTimeEnum::getCode, FileShareOutTimeEnum::getValue));
    }

    public static Long getOutTime(Integer code) {
        return map.get(code);
    }
}
